package com.coderman.common.starter.controller;

import com.coderman.common.starter.Constants;
import com.coderman.common.starter.logparam.annotations.RequestLogic;
import com.coderman.common.starter.nacos.paperwork.service.PaperTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Description:
 * date: 2020/10/14
 *
 * @author fanchunshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@RestController
public class PaperTextController {

    @Autowired
    private PaperTextService paperTextService;

    @GetMapping(value = "/getByGroupId")
    @RequestLogic(logInParam = true,logOutParam = true,exeTime = true)
    public String getSMSMessage(@RequestParam(value = "groupId") String groupId){
        Map<String,String> varMap = new HashMap<>();
        varMap.put("orderCode","2020090900001");
        varMap.put("company","申通快递");
        varMap.put("phone","01001-002323");

        String x = paperTextService.getMsgFromTemplate(Constants.SMS_DataId,groupId,varMap);
        System.out.println("x = "+x);
        return x;
    }

}
